/*
 * @Author: 卡卡 1071780426@qq.com
 * @Date: 2022-07-04 12:42:39
 * @LastEditors: 卡卡 1071780426@qq.com
 * @LastEditTime: 2022-07-29 11:21:59
 * @FilePath: \inspectionTestSystem\store\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		uerInfo: {},
		hasLogin: false
	},
	mutations: {
		login(state, provider) {
	
			state.hasLogin = true
			state.uerInfo.token = provider.token
			state.uerInfo.userName = provider.user_name
			state.uerInfo.userPassword = provider.password
			uni.setStorage({
				key: 'uerInfo',
				data: provider
			})
		},
		logout(state) {
			state.hasLogin = false
			state.uerInfo = {}
			uni.removeStorage({
				key: 'uerInfo'
			});
		}
	}
})

export default store
